TypeScript APIs
Last updated on 13-May-2020 by Jakob Jakobsen Boysen
On this page
Importing
All Scifeon TypeScript classes are located in the namespaces scifeon-*
. Further, many classes are prefixed with Scifeon
, but can be accessed without the prefix. For example the statements below are equivalent:
import { ConsoleLogger } from 'scifeon';
import { ScifeonConsoleLogger } from 'scifeon';
The Scifeon TypeScript classes can be used in the Apps by importing them and injecting them:
import { autoinject, ConsoleLogger } from 'scifeon';
@autoinject
export class CustomPage {
constructor(private logger: ConsoleLogger) {
this.logger.debug('The logger can now be used');
}
}
The autoinject
decorator automatically injects an instance of the logger into the constructor, and the logger can now be used throughout all methods in the class because it has been set on the object using the private
modifier in the parameters list of the constructor.
TypeScript classes
In the class documentation, we use TypeScript types to indicate the parameter types and the return types.